home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60src.lha / Vim / vim60 / src / structs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-16  |  51.6 KB  |  1,656 lines

  1. /* vi:set ts=8 sts=4 sw=4:
  2.  *
  3.  * VIM - Vi IMproved    by Bram Moolenaar
  4.  *
  5.  * Do ":help uganda"  in Vim to read copying and usage conditions.
  6.  * Do ":help credits" in Vim to see a list of people who contributed.
  7.  */
  8.  
  9. /*
  10.  * This file contains various definitions of structures that are used by Vim
  11.  */
  12.  
  13. /*
  14.  * There is something wrong in the SAS compiler that makes typedefs not
  15.  * valid in include files.  Has been fixed in version 6.58.
  16.  */
  17. #if defined(SASC) && SASC < 658
  18. typedef long        linenr_T;
  19. typedef unsigned    colnr_T;
  20. typedef unsigned short    short_u;
  21. #endif
  22.  
  23. /*
  24.  * position in file or buffer
  25.  */
  26. typedef struct
  27. {
  28.     linenr_T    lnum;    /* line number */
  29.     colnr_T    col;    /* column number */
  30. #ifdef FEAT_VIRTUALEDIT
  31.     colnr_T    coladd;
  32. #endif
  33. } pos_T;
  34.  
  35. /*
  36.  * Same, but without coladd.
  37.  */
  38. typedef struct
  39. {
  40.     linenr_T    lnum;    /* line number */
  41.     colnr_T    col;    /* column number */
  42. } lpos_T;
  43.  
  44. /*
  45.  * Structure used for growing arrays.
  46.  * This is used to store information that only grows, is deleted all at
  47.  * once, and needs to be accessed by index.  See ga_clear() and ga_grow().
  48.  */
  49. typedef struct growarray
  50. {
  51.     int        ga_len;            /* current number of items used */
  52.     int        ga_room;            /* number of unused items at the end */
  53.     int        ga_itemsize;        /* sizeof one item */
  54.     int        ga_growsize;        /* number of items to grow each time */
  55.     void    *ga_data;            /* pointer to the first item */
  56. } garray_T;
  57.  
  58. /*
  59.  * This is here because regexp.h needs pos_T and below regprog_T is used.
  60.  */
  61. #include "regexp.h"
  62.  
  63. typedef struct window    win_T;
  64. typedef struct wininfo    wininfo_T;
  65. typedef struct frame    frame_T;
  66. typedef int        scid_T;        /* script ID */
  67.  
  68. /*
  69.  * This is here because gui.h needs the pos_T and win_T, and win_T needs gui.h
  70.  * for scrollbar_T.
  71.  */
  72. #ifdef FEAT_GUI
  73. # include "gui.h"
  74. #else
  75. # ifdef FEAT_XCLIPBOARD
  76. #  include <X11/Intrinsic.h>
  77. # endif
  78. # define guicolor_T int        /* avoid error in prototypes */
  79. #endif
  80.  
  81. /*
  82.  * marks: positions in a file
  83.  * (a normal mark is a lnum/col pair, the same as a file position)
  84.  */
  85.  
  86. /* (Note: for EBCDIC there are more than 26, because there are gaps in the
  87.  * alphabet coding.  To minimize changes to the code, I decided to just
  88.  * increase the number of possible marks. */
  89. #define NMARKS        ('z' - 'a' + 1)    /* max. # of named marks */
  90. #define JUMPLISTSIZE    100        /* max. # of marks in jump list */
  91. #define TAGSTACKSIZE    20        /* max. # of tags in tag stack */
  92.  
  93. typedef struct filemark
  94. {
  95.     pos_T    mark;        /* cursor position */
  96.     int        fnum;        /* file number */
  97. } fmark_T;
  98.  
  99. /* Xtended file mark: also has a file name */
  100. typedef struct xfilemark
  101. {
  102.     fmark_T    fmark;
  103.     char_u    *fname;        /* file name, used when fnum == 0 */
  104. } xfmark_T;
  105.  
  106. /*
  107.  * The taggy struct is used to store the information about a :tag command.
  108.  */
  109. typedef struct taggy
  110. {
  111.     char_u    *tagname;    /* tag name */
  112.     fmark_T    fmark;        /* cursor position BEFORE ":tag" */
  113.     int        cur_match;    /* match number */
  114. } taggy_T;
  115.  
  116. /*
  117.  * Structure that contains all options that are local to a window.
  118.  * Used twice in a window: for the current buffer and for all buffers.
  119.  * Also used in wininfo_T.
  120.  */
  121. typedef struct
  122. {
  123. #ifdef FEAT_DIFF
  124.     int        wo_diff;
  125. # define w_p_diff w_onebuf_opt.wo_diff    /* 'diff' */
  126. #endif
  127. #ifdef FEAT_FOLDING
  128.     long    wo_fdc;
  129. # define w_p_fdc w_onebuf_opt.wo_fdc    /* 'foldcolumn' */
  130.     int        wo_fen;
  131. # define w_p_fen w_onebuf_opt.wo_fen    /* 'foldenable' */
  132.     char_u    *wo_fdi;
  133. # define w_p_fdi w_onebuf_opt.wo_fdi    /* 'foldignore' */
  134.     long    wo_fdl;
  135. # define w_p_fdl w_onebuf_opt.wo_fdl    /* 'foldlevel' */
  136.     char_u    *wo_fdm;
  137. # define w_p_fdm w_onebuf_opt.wo_fdm    /* 'foldmethod' */
  138.     long    wo_fml;
  139. # define w_p_fml w_onebuf_opt.wo_fml    /* 'foldminlines' */
  140.     long    wo_fdn;
  141. # define w_p_fdn w_onebuf_opt.wo_fdn    /* 'foldnextmax' */
  142. # ifdef FEAT_EVAL
  143.     char_u    *wo_fde;
  144. # define w_p_fde w_onebuf_opt.wo_fde    /* 'foldexpr' */
  145.     char_u    *wo_fdt;
  146. #  define w_p_fdt w_onebuf_opt.wo_fdt    /* 'foldtext' */
  147. # endif
  148.     char_u    *wo_fmr;
  149. # define w_p_fmr w_onebuf_opt.wo_fmr    /* 'foldmarker' */
  150. #endif
  151. #ifdef FEAT_LINEBREAK
  152.     int        wo_lbr;
  153. # define w_p_lbr w_onebuf_opt.wo_lbr    /* 'linebreak' */
  154. #endif
  155.     int        wo_list;
  156. #define w_p_list w_onebuf_opt.wo_list    /* 'list' */
  157.     int        wo_nu;
  158. #define w_p_nu w_onebuf_opt.wo_nu    /* 'number' */
  159. #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
  160.     int        wo_pvw;
  161. # define w_p_pvw w_onebuf_opt.wo_pvw    /* 'previewwindow' */
  162. #endif
  163. #ifdef FEAT_RIGHTLEFT
  164.     int        wo_rl;
  165. # define w_p_rl w_onebuf_opt.wo_rl    /* 'rightleft' */
  166. #endif
  167.     long    wo_scr;
  168. #define w_p_scr w_onebuf_opt.wo_scr    /* 'scroll' */
  169. #ifdef FEAT_SCROLLBIND
  170.     int        wo_scb;
  171. # define w_p_scb w_onebuf_opt.wo_scb    /* 'scrollbind' */
  172. #endif
  173.     int        wo_wrap;
  174. #define w_p_wrap w_onebuf_opt.wo_wrap    /* 'wrap' */
  175. } winopt_T;
  176.  
  177. /*
  178.  * Window info stored with a buffer.
  179.  *
  180.  * Two types of info are kept for a buffer which are associated with a
  181.  * specific window:
  182.  * 1. Each window can have a different line number associated with a buffer.
  183.  * 2. The window-local options for a buffer work in a similar way.
  184.  * The window-info is kept in a list at b_wininfo.  It is kept in
  185.  * most-recently-used order.
  186.  */
  187. struct wininfo
  188. {
  189.     wininfo_T    *wi_next;    /* next entry or NULL for last entry */
  190.     wininfo_T    *wi_prev;    /* previous entry or NULL for first entry */
  191.     win_T    *wi_win;    /* pointer to window that did set wi_lnum */
  192.     pos_T    wi_fpos;    /* last cursor position in the file */
  193.     int        wi_optset;    /* TRUE when wi_opt has useful values */
  194.     winopt_T    wi_opt;        /* local window options */
  195. #ifdef FEAT_FOLDING
  196.     int        wi_fold_manual;    /* copy of w_fold_manual */
  197.     garray_T    wi_folds;    /* clone of w_folds */
  198. #endif
  199. };
  200.  
  201. /*
  202.  * Info used to pass info about a fold from the fold-detection code to the
  203.  * code that displays the foldcolumn.
  204.  */
  205. typedef struct foldinfo
  206. {
  207.     int        fi_level;    /* level of the fold; when this is zero the
  208.                    other fields are invalid */
  209.     int        fi_lnum;    /* line number where fold starts */
  210.     int        fi_low_level;    /* lowest fold level that starts in the same
  211.                    line */
  212. } foldinfo_T;
  213.  
  214. /*
  215.  * stuctures used for undo
  216.  */
  217.  
  218. typedef struct u_entry u_entry_T;
  219. typedef struct u_header u_header_T;
  220. struct u_entry
  221. {
  222.     u_entry_T    *ue_next;    /* pointer to next entry in list */
  223.     linenr_T    ue_top;        /* number of line above undo block */
  224.     linenr_T    ue_bot;        /* number of line below undo block */
  225.     linenr_T    ue_lcount;    /* linecount when u_save called */
  226.     char_u    **ue_array;    /* array of lines in undo block */
  227.     long    ue_size;    /* number of lines in ue_array */
  228. };
  229.  
  230. struct u_header
  231. {
  232.     u_header_T    *uh_next;    /* pointer to next header in list */
  233.     u_header_T    *uh_prev;    /* pointer to previous header in list */
  234.     u_entry_T    *uh_entry;    /* pointer to first entry */
  235.     pos_T    uh_cursor;    /* cursor position before saving */
  236. #ifdef FEAT_VIRTUALEDIT
  237.     long    uh_cursor_vcol;
  238. #endif
  239.     int        uh_flags;    /* see below */
  240.     pos_T    uh_namedm[NMARKS];    /* marks before undo/after redo */
  241. };
  242.  
  243. /* values for uh_flags */
  244. #define UH_CHANGED  0x01    /* b_changed flag before undo/after redo */
  245. #define UH_EMPTYBUF 0x02    /* buffer was empty */
  246.  
  247. /*
  248.  * stuctures used in undo.c
  249.  */
  250. #if SIZEOF_INT > 2
  251. # define ALIGN_LONG    /* longword alignment and use filler byte */
  252. # define ALIGN_SIZE (sizeof(long))
  253. #else
  254. # define ALIGN_SIZE (sizeof(short))
  255. #endif
  256.  
  257. #define ALIGN_MASK (ALIGN_SIZE - 1)
  258.  
  259. typedef struct m_info minfo_T;
  260.  
  261. /*
  262.  * stucture used to link chunks in one of the free chunk lists.
  263.  */
  264. struct m_info
  265. {
  266. #ifdef ALIGN_LONG
  267.     long_u    m_size;        /* size of the chunk (including m_info) */
  268. #else
  269.     short_u    m_size;        /* size of the chunk (including m_info) */
  270. #endif
  271.     minfo_T    *m_next;    /* pointer to next free chunk in the list */
  272. };
  273.  
  274. /*
  275.  * structure used to link blocks in the list of allocated blocks.
  276.  */
  277. typedef struct m_block mblock_T;
  278. struct m_block
  279. {
  280.     mblock_T    *mb_next;    /* pointer to next allocated block */
  281.     size_t    mb_size;    /* total size of all chunks in this block */
  282.     minfo_T    mb_info;    /* head of free chuck list for this block */
  283. };
  284.  
  285. /*
  286.  * things used in memfile.c
  287.  */
  288.  
  289. typedef struct block_hdr    bhdr_T;
  290. typedef struct memfile        memfile_T;
  291. typedef long            blocknr_T;
  292.  
  293. /*
  294.  * for each (previously) used block in the memfile there is one block header.
  295.  *
  296.  * The block may be linked in the used list OR in the free list.
  297.  * The used blocks are also kept in hash lists.
  298.  *
  299.  * The used list is a doubly linked list, most recently used block first.
  300.  *    The blocks in the used list have a block of memory allocated.
  301.  *    mf_used_count is the number of pages in the used list.
  302.  * The hash lists are used to quickly find a block in the used list.
  303.  * The free list is a single linked list, not sorted.
  304.  *    The blocks in the free list have no block of memory allocated and
  305.  *    the contents of the block in the file (if any) is irrelevant.
  306.  */
  307.  
  308. struct block_hdr
  309. {
  310.     bhdr_T    *bh_next;        /* next block_hdr in free or used list */
  311.     bhdr_T    *bh_prev;        /* previous block_hdr in used list */
  312.     bhdr_T    *bh_hash_next;        /* next block_hdr in hash list */
  313.     bhdr_T    *bh_hash_prev;        /* previous block_hdr in hash list */
  314.     blocknr_T    bh_bnum;        /* block number */
  315.     char_u    *bh_data;        /* pointer to memory (for used block) */
  316.     int        bh_page_count;        /* number of pages in this block */
  317.  
  318. #define BH_DIRTY    1
  319. #define BH_LOCKED   2
  320.     char    bh_flags;        /* BH_DIRTY or BH_LOCKED */
  321. };
  322.  
  323. /*
  324.  * when a block with a negative number is flushed to the file, it gets
  325.  * a positive number. Because the reference to the block is still the negative
  326.  * number, we remember the translation to the new positive number in the
  327.  * double linked trans lists. The structure is the same as the hash lists.
  328.  */
  329. typedef struct nr_trans NR_TRANS;
  330.  
  331. struct nr_trans
  332. {
  333.     NR_TRANS    *nt_next;        /* next nr_trans in hash list */
  334.     NR_TRANS    *nt_prev;        /* previous nr_trans in hash list */
  335.     blocknr_T    nt_old_bnum;        /* old, negative, number */
  336.     blocknr_T    nt_new_bnum;        /* new, positive, number */
  337. };
  338.  
  339. /*
  340.  * used for completion on the command line
  341.  */
  342. typedef struct expand
  343. {
  344.     int        xp_context;        /* type of expansion */
  345.     char_u    *xp_pattern;        /* start of item to expand */
  346.     int        xp_set_path;        /* ":set path=/dir/<Tab>" */
  347. } expand_T;
  348.  
  349. /*
  350.  * Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag.
  351.  * This needs to be saved for recursive commands, put them in a structure for
  352.  * easy manipulation.
  353.  */
  354. typedef struct
  355. {
  356.     int        hide;            /* TRUE when ":hide" was used */
  357. # ifdef FEAT_BROWSE
  358.     int        browse;            /* TRUE to invoke file dialog */
  359. # endif
  360. # ifdef FEAT_WINDOWS
  361.     int        split;            /* flags for win_split() */
  362. # endif
  363. # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
  364.     int        confirm;        /* TRUE to invoke yes/no dialog */
  365. # endif
  366. } cmdmod_T;
  367.  
  368. /*
  369.  * Simplistic hashing scheme to quickly locate the blocks in the used list.
  370.  * 64 blocks are found directly (64 * 4K = 256K, most files are smaller).
  371.  */
  372. #define MEMHASHSIZE    64
  373. #define MEMHASH(nr)    ((nr) & (MEMHASHSIZE - 1))
  374.  
  375. struct memfile
  376. {
  377.     char_u    *mf_fname;        /* name of the file */
  378.     char_u    *mf_ffname;        /* idem, full path */
  379.     int        mf_fd;            /* file descriptor */
  380.     bhdr_T    *mf_free_first;        /* first block_hdr in free list */
  381.     bhdr_T    *mf_used_first;        /* mru block_hdr in used list */
  382.     bhdr_T    *mf_used_last;        /* lru block_hdr in used list */
  383.     unsigned    mf_used_count;        /* number of pages in used list */
  384.     unsigned    mf_used_count_max;    /* maximum number of pages in memory */
  385.     bhdr_T    *mf_hash[MEMHASHSIZE];    /* array of hash lists */
  386.     NR_TRANS    *mf_trans[MEMHASHSIZE];    /* array of trans lists */
  387.     blocknr_T    mf_blocknr_max;        /* highest positive block number + 1*/
  388.     blocknr_T    mf_blocknr_min;        /* lowest negative block number - 1 */
  389.     blocknr_T    mf_neg_count;        /* number of negative blocks numbers */
  390.     blocknr_T    mf_infile_count;    /* number of pages in the file */
  391.     unsigned    mf_page_size;        /* number of bytes in a page */
  392.     int        mf_dirty;        /* TRUE if there are dirty blocks */
  393. };
  394.  
  395. /*
  396.  * things used in memline.c
  397.  */
  398. /*
  399.  * When searching for a specific line, we remember what blocks in the tree
  400.  * are the branches leading to that block. This is stored in ml_stack.  Each
  401.  * entry is a pointer to info in a block (may be data block or pointer block)
  402.  */
  403. typedef struct info_pointer
  404. {
  405.     blocknr_T    ip_bnum;    /* block number */
  406.     linenr_T    ip_low;        /* lowest lnum in this block */
  407.     linenr_T    ip_high;    /* highest lnum in this block */
  408.     int        ip_index;    /* index for block with current lnum */
  409. } infoptr_T;    /* block/index pair */
  410.  
  411. #ifdef FEAT_BYTEOFF
  412. typedef struct ml_chunksize
  413. {
  414.     int        mlcs_numlines;
  415.     long    mlcs_totalsize;
  416. } chunksize_T;
  417.  
  418.  /* Flags when calling ml_updatechunk() */
  419.  
  420. #define ML_CHNK_ADDLINE 1
  421. #define ML_CHNK_DELLINE 2
  422. #define ML_CHNK_UPDLINE 3
  423. #endif
  424.  
  425. /*
  426.  * the memline structure holds all the information about a memline
  427.  */
  428. typedef struct memline
  429. {
  430.     linenr_T    ml_line_count;    /* number of lines in the buffer */
  431.  
  432.     memfile_T    *ml_mfp;    /* pointer to associated memfile */
  433.  
  434. #define ML_EMPTY    1    /* empty buffer */
  435. #define ML_LINE_DIRTY    2    /* cached line was changed and allocated */
  436. #define ML_LOCKED_DIRTY    4    /* ml_locked was changed */
  437. #define ML_LOCKED_POS    8    /* ml_locked needs positive block number */
  438.     int        ml_flags;
  439.  
  440.     infoptr_T    *ml_stack;    /* stack of pointer blocks (array of IPTRs) */
  441.     int        ml_stack_top;    /* current top if ml_stack */
  442.     int        ml_stack_size;    /* total number of entries in ml_stack */
  443.  
  444.     linenr_T    ml_line_lnum;    /* line number of cached line, 0 if not valid */
  445.     char_u    *ml_line_ptr;    /* pointer to cached line */
  446.  
  447.     bhdr_T    *ml_locked;    /* block used by last ml_get */
  448.     linenr_T    ml_locked_low;    /* first line in ml_locked */
  449.     linenr_T    ml_locked_high;    /* last line in ml_locked */
  450.     int        ml_locked_lineadd;  /* number of lines inserted in ml_locked */
  451. #ifdef FEAT_BYTEOFF
  452.     chunksize_T *ml_chunksize;
  453.     int        ml_numchunks;
  454.     int        ml_usedchunks;
  455. #endif
  456. } memline_T;
  457.  
  458. #if defined(FEAT_SIGNS) || defined(PROTO)
  459. typedef struct signlist signlist_T;
  460.  
  461. struct signlist
  462. {
  463.     int        id;        /* unique identifier for each placed sign */
  464.     linenr_T    lnum;        /* line number which has this sign */
  465.     int        typenr;        /* typenr of sign */
  466.     signlist_T    *next;        /* next signlist entry */
  467. };
  468. #endif
  469.  
  470. /*
  471.  * Argument list: Array of file names.
  472.  * Used for the global argument list and the argument lists local to a window.
  473.  */
  474. typedef struct arglist
  475. {
  476.     garray_T    al_ga;        /* growarray with the array of file names */
  477.     int        al_refcount;    /* number of windows using this arglist */
  478. } alist_T;
  479.  
  480. /*
  481.  * For each argument remember the file name as it was given, and the buffer
  482.  * number that contains the expanded file name (required for when ":cd" is
  483.  * used.
  484.  */
  485. typedef struct argentry
  486. {
  487.     char_u    *ae_fname;    /* file name as specified */
  488.     int        ae_fnum;    /* buffer number with expanded file name */
  489. } aentry_T;
  490.  
  491. #ifdef FEAT_WINDOWS
  492. # define ALIST(win) (win)->w_alist
  493. #else
  494. # define ALIST(win) (&global_alist)
  495. #endif
  496. #define GARGLIST    ((aentry_T *)global_alist.al_ga.ga_data)
  497. #define ARGLIST        ((aentry_T *)ALIST(curwin)->al_ga.ga_data)
  498. #define WARGLIST(wp)    ((aentry_T *)ALIST(wp)->al_ga.ga_data)
  499. #define AARGLIST(al)    ((aentry_T *)((al)->al_ga.ga_data))
  500. #define GARGCOUNT    (global_alist.al_ga.ga_len)
  501. #define ARGCOUNT    (ALIST(curwin)->al_ga.ga_len)
  502. #define WARGCOUNT(wp)    (ALIST(wp)->al_ga.ga_len)
  503.  
  504. #ifdef FEAT_EVAL
  505. /*
  506.  * For conditional commands a stack is kept of nested conditionals.
  507.  * When cs_idx < 0, there is no conditional command.
  508.  */
  509. # define CSTACK_LEN    50
  510.  
  511. struct condstack
  512. {
  513.     char    cs_flags[CSTACK_LEN];    /* CSF_ flags */
  514.     int        cs_line[CSTACK_LEN];    /* line number of ":while" line */
  515.     int        cs_idx;            /* current entry, or -1 if none */
  516.     int        cs_whilelevel;        /* number of nested ":while"s */
  517.     char    cs_had_while;        /* just found ":while" */
  518.     char    cs_had_continue;    /* just found ":continue" */
  519.     char    cs_had_endwhile;    /* just found ":endwhile" */
  520. };
  521.  
  522. # define CSF_TRUE    1    /* condition was TRUE */
  523. # define CSF_ACTIVE    2    /* current state is active */
  524. # define CSF_WHILE    4    /* is a ":while" */
  525. #endif
  526.  
  527. #ifdef FEAT_SYN_HL
  528. /* struct passed to in_id_list() */
  529. struct sp_syn
  530. {
  531.     int        inc_tag;    /* ":syn include" unique tag */
  532.     short    id;        /* highlight group ID of item */
  533.     short    *cont_in_list;    /* cont.in group IDs, if non-zero */
  534. };
  535.  
  536. /*
  537.  * Each keyword has one keyentry, which is linked in a hash list.
  538.  */
  539. typedef struct keyentry keyentry_T;
  540.  
  541. struct keyentry
  542. {
  543.     keyentry_T    *next;        /* next keyword in the hash list */
  544.     struct sp_syn k_syn;    /* struct passed to in_id_list() */
  545.     short    *next_list;    /* ID list for next match (if non-zero) */
  546.     short    flags;        /* see syntax.c */
  547.     char_u    keyword[1];    /* actually longer */
  548. };
  549.  
  550. /*
  551.  * Struct used to store one state of the state stack.
  552.  */
  553. typedef struct buf_state
  554. {
  555.     int            bs_idx;     /* index of pattern */
  556.     int            bs_flags;     /* flags for pattern */
  557.     reg_extmatch_T *bs_extmatch; /* external matches from start pattern */
  558. } bufstate_T;
  559.  
  560. /*
  561.  * syn_state contains the syntax state stack for the start of one line.
  562.  * Used by b_sst_array[].
  563.  */
  564. typedef struct syn_state synstate_T;
  565.  
  566. struct syn_state
  567. {
  568.     synstate_T    *sst_next;    /* next entry in used or free list */
  569.     linenr_T    sst_lnum;    /* line number for this state */
  570.     union
  571.     {
  572.     bufstate_T    sst_stack[SST_FIX_STATES]; /* short state stack */
  573.     garray_T    sst_ga;    /* growarray for long state stack */
  574.     } sst_union;
  575.     int        sst_next_flags;    /* flags for sst_next_list */
  576.     short    *sst_next_list;    /* "nextgroup" list in this state
  577.                  * (this is a copy, don't free it! */
  578.     short    sst_stacksize;    /* number of states on the stack */
  579.     disptick_T    sst_tick;    /* tick when last displayed */
  580.     linenr_T    sst_change_lnum;/* when non-zero, change in this line
  581.                  * may have made the state invalid */
  582. };
  583. #endif /* FEAT_SYN_HL */
  584.  
  585. /*
  586.  * Structure shared between syntax.c, screen.c and gui_x11.c.
  587.  */
  588. typedef struct attr_entry
  589. {
  590.     short        ae_attr;        /* HL_BOLD, etc. */
  591.     union
  592.     {
  593.     struct
  594.     {
  595.         char_u        *start;    /* start escape sequence */
  596.         char_u        *stop;    /* stop escape sequence */
  597.     } term;
  598.     struct
  599.     {
  600.         char_u        fg_color;    /* foreground color number */
  601.         char_u        bg_color;    /* background color number */
  602.     } cterm;
  603. # ifdef FEAT_GUI
  604.     struct
  605.     {
  606.         guicolor_T        fg_color;    /* foreground color handle */
  607.         guicolor_T        bg_color;    /* background color handle */
  608.         GuiFont        font;    /* font handle */
  609. #  ifdef FEAT_XFONTSET
  610.         GuiFontset        fontset;    /* fontset handle */
  611. #  endif
  612.     } gui;
  613. # endif
  614.     } ae_u;
  615. } attrentry_T;
  616.  
  617. #ifdef USE_ICONV
  618. # ifdef HAVE_ICONV_H
  619. #  include <iconv.h>
  620. # else
  621. #  include <errno.h>
  622. typedef void *iconv_t;
  623. # endif
  624. #endif
  625.  
  626. /*
  627.  * Used for the typeahead buffer: typebuf.
  628.  */
  629. typedef struct
  630. {
  631.     char_u    *tb_buf;    /* buffer for typed characters */
  632.     char_u    *tb_noremap;    /* mapping flags for characters in tb_buf[] */
  633.     int        tb_buflen;    /* size of tb_buf[] */
  634.     int        tb_off;        /* current position in tb_buf[] */
  635.     int        tb_len;        /* number of valid chars in tb_buf[] */
  636.     int        tb_maplen;    /* nr of mapped characters in tb_buf[] */
  637.     int        tb_silent;    /* nr of silently mapped chars in tb_buf[] */
  638.     int        tb_no_abbr_cnt; /* nr of chars without abbrev. in tb_buf[] */
  639. } typebuf_T;
  640.  
  641. /*
  642.  * Used for conversion of terminal I/O and script files.
  643.  */
  644. typedef struct
  645. {
  646.     int        vc_type;        /* zero or one of the CONV_ values */
  647.     int        vc_factor;        /* max. expansion factor */
  648. # ifdef USE_ICONV
  649.     iconv_t    vc_fd;            /* for CONV_ICONV */
  650. # endif
  651. } vimconv_T;
  652.  
  653. /*
  654.  * Structure used for reading from the viminfo file.
  655.  */
  656. typedef struct
  657. {
  658.     char_u    *vir_line;    /* text of the current line */
  659.     FILE    *vir_fd;    /* file descriptor */
  660. #ifdef FEAT_MBYTE
  661.     vimconv_T    vir_conv;    /* encoding conversion */
  662. #endif
  663. } vir_T;
  664.  
  665. #define CONV_NONE    0
  666. #define CONV_TO_UTF8    1
  667. #define CONV_TO_LATIN1    2
  668. #define CONV_ICONV    3
  669.  
  670. /*
  671.  * Structure used for mappings and abbreviations.
  672.  */
  673. typedef struct mapblock mapblock_T;
  674. struct mapblock
  675. {
  676.     mapblock_T    *m_next;    /* next mapblock in list */
  677.     char_u    *m_keys;    /* mapped from */
  678.     int        m_keylen;    /* strlen(m_keys) */
  679.     char_u    *m_str;        /* mapped to */
  680.     int        m_mode;        /* valid mode */
  681.     int        m_noremap;    /* if non-zero no re-mapping for m_str */
  682.     char    m_silent;    /* <silent> used, don't echo commands */
  683.     scid_T    m_script_ID;    /* ID of script where map was defined,
  684.                    used for s: variables and functions */
  685. };
  686.  
  687. /*
  688.  * Used for highlighting in the status line.
  689.  */
  690. struct stl_hlrec
  691. {
  692.     char_u    *start;
  693.     int        userhl;
  694. };
  695.  
  696. /*
  697.  * buffer: structure that holds information about one file
  698.  *
  699.  * Several windows can share a single Buffer
  700.  * A buffer is unallocated if there is no memfile for it.
  701.  * A buffer is new if the associated file has never been loaded yet.
  702.  */
  703.  
  704. typedef struct file_buffer buf_T;
  705.  
  706. struct file_buffer
  707. {
  708.     memline_T    b_ml;        /* associated memline (also contains line
  709.                    count) */
  710.  
  711.     buf_T    *b_next;    /* links in list of buffers */
  712.     buf_T    *b_prev;
  713.  
  714.     int        b_nwindows;    /* nr of windows open on this buffer */
  715.  
  716.     int        b_flags;    /* various BF_ flags */
  717.  
  718.     /*
  719.      * b_ffname has the full path of the file (NULL for no name).
  720.      * b_sfname is the name as the user typed it (or NULL).
  721.      * b_fname is the same as b_sfname, unless ":cd" has been done,
  722.      *        then it is the same as b_ffname (NULL for no name).
  723.      */
  724.     char_u    *b_ffname;    /* full path file name */
  725.     char_u    *b_sfname;    /* short file name */
  726.     char_u    *b_fname;    /* current file name */
  727.  
  728. #ifdef UNIX
  729.     int        b_dev;        /* device number (-1 if not set) */
  730.     ino_t    b_ino;        /* inode number */
  731. #endif
  732. #ifdef MACOS
  733.     FSSpec    b_FSSpec;    /* MacOS File Identification */
  734. #endif
  735. #ifdef VMS
  736.     char    b_fab_rfm;    /* Record format */
  737. #endif
  738. #ifdef FEAT_SNIFF
  739.     int        b_sniff;    /* file was loaded through Sniff */
  740. #endif
  741.  
  742.     int        b_fnum;        /* buffer number for this file. */
  743.  
  744.     int        b_changed;    /* 'modified': Set to TRUE if something in the
  745.                    file has been changed and not written out. */
  746.     int        b_changedtick;    /* incremented for each change, also for undo */
  747.  
  748.     /*
  749.      * Changes to a buffer require updating of the display.  To minimize the
  750.      * work, remember changes made and update everything at once.
  751.      */
  752.     int        b_mod_set;    /* TRUE when there are changes since the last
  753.                    time the display was updated */
  754.     linenr_T    b_mod_top;    /* topmost lnum that was changed */
  755.     linenr_T    b_mod_bot;    /* lnum below last changed line, AFTER the
  756.                    change */
  757.     long    b_mod_xlines;    /* number of extra buffer lines inserted;
  758.                    negative when lines were deleted */
  759.  
  760.     wininfo_T    *b_wininfo;    /* list of last used info for each window */
  761.  
  762.     long    b_mtime;    /* last change time of original file */
  763.     long    b_mtime_read;    /* last change time when reading */
  764.     size_t    b_orig_size;    /* size of original file in bytes */
  765.     int        b_orig_mode;    /* mode of original file */
  766.  
  767.     pos_T    b_namedm[NMARKS]; /* current named marks (mark.c) */
  768.  
  769. #ifdef FEAT_VISUAL
  770.     /* These variables are set when VIsual_active becomes FALSE */
  771.     pos_T    b_visual_start;    /* start pos of last VIsual */
  772.     pos_T    b_visual_end;    /* end position of last VIsual */
  773.     int        b_visual_mode;    /* VIsual_mode of last VIsual */
  774.     colnr_T    b_visual_curswant;   /* MAXCOL from w_curswant */
  775. #endif
  776.  
  777.     pos_T    b_last_cursor;    /* cursor position when last unloading this
  778.                    buffer */
  779.     pos_T    b_last_insert;    /* where Insert mode was left */
  780.     pos_T    b_last_change;    /* position of last change: '. mark */
  781.  
  782.     /*
  783.      * Character table, only used in charset.c for 'iskeyword'
  784.      * 32 bytes of 8 bits: 1 bit per character 0-255.
  785.      */
  786.     char_u    b_chartab[32];
  787.  
  788. #ifdef FEAT_LOCALMAP
  789.     /* Table used for mappings local to a buffer. */
  790.     mapblock_T    *(b_maphash[256]);
  791.  
  792.     /* First abbreviation local to a buffer. */
  793.     mapblock_T    *b_first_abbr;
  794. #endif
  795. #ifdef FEAT_USR_CMDS
  796.     /* User commands local to the buffer. */
  797.     garray_T    b_ucmds;
  798. #endif
  799.     /*
  800.      * start and end of an operator, also used for '[ and ']
  801.      */
  802.     pos_T    b_op_start;
  803.     pos_T    b_op_end;
  804.  
  805. #ifdef FEAT_VIMINFO
  806.     int        b_marks_read;    /* Have we read viminfo marks yet? */
  807. #endif
  808.  
  809.     /*
  810.      * The following only used in undo.c.
  811.      */
  812.     u_header_T    *b_u_oldhead;    /* pointer to oldest header */
  813.     u_header_T    *b_u_newhead;    /* pointer to newest header */
  814.     u_header_T    *b_u_curhead;    /* pointer to current header */
  815.     int        b_u_numhead;    /* current number of headers */
  816.     int        b_u_synced;    /* entry lists are synced */
  817.  
  818.     /*
  819.      * variables for "U" command in undo.c
  820.      */
  821.     char_u    *b_u_line_ptr;    /* saved line for "U" command */
  822.     linenr_T    b_u_line_lnum;    /* line number of line in u_line */
  823.     colnr_T    b_u_line_colnr;    /* optional column number */
  824.  
  825.     /*
  826.      * The following only used in undo.c
  827.      */
  828.     mblock_T    b_block_head;    /* head of allocated memory block list */
  829.     minfo_T    *b_m_search;    /* pointer to chunk before previously
  830.                    allocated/freed chunk */
  831.     mblock_T    *b_mb_current;    /* block where m_search points in */
  832. #ifdef FEAT_INS_EXPAND
  833.     int        b_scanned;    /* ^N/^P have scanned this buffer */
  834. #endif
  835.  
  836.     /* flags for use of ":lmap" and IM control */
  837.     long    b_p_iminsert;    /* input mode for insert */
  838.     long    b_p_imsearch;    /* input mode for search */
  839. #define B_IMODE_USE_INSERT -1    /*    Use b_p_iminsert value for search */
  840. #define B_IMODE_NONE 0        /*    Input via none */
  841. #define B_IMODE_LMAP 1        /*    Input via langmap */
  842. #ifndef USE_IM_CONTROL
  843. # define B_IMODE_LAST 1
  844. #else
  845. # define B_IMODE_IM 2        /*    Input via input method */
  846. # define B_IMODE_LAST 2
  847. #endif
  848.  
  849. #ifdef FEAT_KEYMAP
  850.     short    b_kmap_state;    /* using "lmap" mappings */
  851. # define KEYMAP_INIT    1    /* 'keymap' was set, call keymap_init() */
  852. # define KEYMAP_LOADED    2    /* 'keymap' mappings have been loaded */
  853.     garray_T    b_kmap_ga;    /* the keymap table */
  854. #endif
  855.  
  856.     /*
  857.      * Options local to a buffer.
  858.      * They are here because their value depends on the type of file
  859.      * or contents of the file being edited.
  860.      */
  861.     int        b_p_initialized;    /* set when options initialized */
  862.  
  863.     int        b_p_ai;        /* 'autoindent' */
  864.     int        b_p_ai_nopaste;    /* b_p_ai saved for paste mode */
  865.     int        b_p_bin;    /* 'binary' */
  866. #ifdef FEAT_MBYTE
  867.     int        b_p_bomb;    /* 'bomb' */
  868. #endif
  869. #if defined(FEAT_QUICKFIX)
  870.     char_u    *b_p_bh;    /* 'bufhidden' */
  871.     char_u    *b_p_bt;    /* 'buftype' */
  872. #endif
  873.     int        b_p_bl;        /* 'buflisted' */
  874. #ifdef FEAT_CINDENT
  875.     int        b_p_cin;    /* 'cindent' */
  876.     char_u    *b_p_cino;    /* 'cinoptions' */
  877.     char_u    *b_p_cink;    /* 'cinkeys' */
  878. #endif
  879. #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT)
  880.     char_u    *b_p_cinw;    /* 'cinwords' */
  881. #endif
  882. #ifdef FEAT_COMMENTS
  883.     char_u    *b_p_com;    /* 'comments' */
  884. #endif
  885. #ifdef FEAT_FOLDING
  886.     char_u    *b_p_cms;    /* 'commentstring' */
  887. #endif
  888. #ifdef FEAT_INS_EXPAND
  889.     char_u    *b_p_cpt;    /* 'complete' */
  890. #endif
  891.     int        b_p_eol;    /* 'endofline' */
  892.     int        b_p_et;        /* 'expandtab' */
  893.     int        b_p_et_nobin;    /* b_p_et saved for binary mode */
  894. #ifdef FEAT_MBYTE
  895.     char_u    *b_p_fenc;    /* 'fileencoding' */
  896. #endif
  897.     char_u    *b_p_ff;    /* 'fileformat' */
  898. #ifdef FEAT_AUTOCMD
  899.     char_u    *b_p_ft;    /* 'filetype' */
  900. #endif
  901.     char_u    *b_p_fo;    /* 'formatoptions' */
  902.     int        b_p_inf;    /* 'infercase' */
  903.     char_u    *b_p_isk;    /* 'iskeyword' */
  904. #ifdef FEAT_FIND_ID
  905.     char_u    *b_p_def;    /* 'define' local value */
  906.     char_u    *b_p_inc;    /* 'include' */
  907. # ifdef FEAT_EVAL
  908.     char_u    *b_p_inex;    /* 'includeexpr' */
  909. # endif
  910. #endif
  911. #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
  912.     char_u    *b_p_inde;    /* 'indentexpr' */
  913.     char_u    *b_p_indk;    /* 'indentkeys' */
  914. #endif
  915. #ifdef FEAT_CRYPT
  916.     char_u    *b_p_key;    /* 'key' */
  917. #endif
  918. #ifdef FEAT_LISP
  919.     int        b_p_lisp;    /* 'lisp' */
  920. #endif
  921.     char_u    *b_p_mps;    /* 'matchpairs' */
  922.     int        b_p_ml;        /* 'modeline' */
  923.     int        b_p_ml_nobin;    /* b_p_ml saved for binary mode */
  924.     int        b_p_ma;        /* 'modifiable' */
  925.     char_u    *b_p_nf;    /* 'nrformats' */
  926. #ifdef FEAT_OSFILETYPE
  927.     char_u    *b_p_oft;    /* 'osfiletype' */
  928. #endif
  929.     int        b_p_ro;        /* 'readonly' */
  930.     long    b_p_sw;        /* 'shiftwidth' */
  931. #ifndef SHORT_FNAME
  932.     int        b_p_sn;        /* 'shortname' */
  933. #endif
  934. #ifdef FEAT_SMARTINDENT
  935.     int        b_p_si;        /* 'smartindent' */
  936. #endif
  937.     long    b_p_sts;    /* 'softtabstop' */
  938.     long    b_p_sts_nopaste; /* b_p_sts saved for paste mode */
  939. #ifdef FEAT_SEARCHPATH
  940.     char_u    *b_p_sua;    /* 'suffixesadd' */
  941. #endif
  942.     int        b_p_swf;    /* 'swapfile' */
  943. #ifdef FEAT_SYN_HL
  944.     char_u    *b_p_syn;    /* 'syntax' */
  945. #endif
  946.     long    b_p_ts;        /* 'tabstop' */
  947.     int        b_p_tx;        /* 'textmode' */
  948.     long    b_p_tw;        /* 'textwidth' */
  949.     long    b_p_tw_nobin;    /* b_p_tw saved for binary mode */
  950.     long    b_p_tw_nopaste;    /* b_p_tw saved for paste mode */
  951.     long    b_p_wm;        /* 'wrapmargin' */
  952.     long    b_p_wm_nobin;    /* b_p_wm saved for binary mode */
  953.     long    b_p_wm_nopaste;    /* b_p_wm saved for paste mode */
  954. #ifdef FEAT_KEYMAP
  955.     char_u    *b_p_keymap;    /* 'keymap' */
  956. #endif
  957.  
  958.     /* local values for options which are normally global */
  959. #ifdef FEAT_QUICKFIX
  960.     char_u    *b_p_gp;    /* 'grepprg' local value */
  961.     char_u    *b_p_mp;    /* 'makeprg' local value */
  962.     char_u    *b_p_efm;    /* 'errorformat' local value */
  963. #endif
  964.     char_u    *b_p_ep;    /* 'equalprg' local value */
  965.     char_u    *b_p_path;    /* 'path' local value */
  966.     int        b_p_ar;        /* 'autoread' local value */
  967.     char_u    *b_p_tags;    /* 'tags' local value */
  968. #ifdef FEAT_INS_EXPAND
  969.     char_u    *b_p_dict;    /* 'dictionary' local value */
  970.     char_u    *b_p_tsr;    /* 'thesaurus' local value */
  971. #endif
  972.  
  973.     /* end of buffer options */
  974.  
  975.     int        b_start_ffc;    /* first char of 'ff' when edit started */
  976. #ifdef FEAT_MBYTE
  977.     char_u    *b_start_fenc;    /* 'fileencoding' when edit started or NULL */
  978. #endif
  979.  
  980. #ifdef FEAT_EVAL
  981.     garray_T    b_vars;        /* internal variables, local to buffer */
  982. #endif
  983.  
  984.     /* When a buffer is created, it starts without a swap file.  b_may_swap is
  985.      * then set to indicate that a swap file may be opened later.  It is reset
  986.      * if a swap file could not be opened.
  987.      */
  988.     int        b_may_swap;
  989.     int        b_did_warn;    /* Set to 1 if user has been warned on first
  990.                    change of a read-only file */
  991.     int        b_help;        /* buffer for help file (when set b_p_bt is
  992.                    "help") */
  993.  
  994. #ifndef SHORT_FNAME
  995.     int        b_shortname;    /* this file has an 8.3 file name */
  996. #endif
  997.  
  998. #ifdef FEAT_PERL
  999.     void    *perl_private;
  1000. #endif
  1001.  
  1002. #ifdef FEAT_PYTHON
  1003.     void    *python_ref;    /* The Python value referring to this buffer */
  1004. #endif
  1005.  
  1006. #ifdef FEAT_TCL
  1007.     void    *tcl_ref;
  1008. #endif
  1009.  
  1010. #ifdef FEAT_RUBY
  1011.     void    *ruby_ref;
  1012. #endif
  1013.  
  1014. #ifdef FEAT_SYN_HL
  1015.     keyentry_T    **b_keywtab;        /* syntax keywords hash table */
  1016.     keyentry_T    **b_keywtab_ic;        /* idem, ignore case */
  1017.     int        b_syn_ic;        /* ignore case for :syn cmds */
  1018.     garray_T    b_syn_patterns;        /* table for syntax patterns */
  1019.     garray_T    b_syn_clusters;        /* table for syntax clusters */
  1020.     int        b_syn_sync_flags;    /* flags about how to sync */
  1021.     short    b_syn_sync_id;        /* group to sync on */
  1022.     long    b_syn_sync_minlines;    /* minimal sync lines offset */
  1023.     long    b_syn_sync_maxlines;    /* maximal sync lines offset */
  1024.     char_u    *b_syn_linecont_pat;    /* line continuation pattern */
  1025.     regprog_T    *b_syn_linecont_prog;    /* line continuation program */
  1026.     int        b_syn_linecont_ic;    /* ignore-case flag for above */
  1027.     int        b_syn_topgrp;        /* for ":syntax include" */
  1028. # ifdef FEAT_FOLDING
  1029.     int        b_syn_folditems;    /* number of patterns with the HL_FOLD
  1030.                        flag set */
  1031. # endif
  1032. /*
  1033.  * b_sst_array[] contains the state stack for a number of lines, for the start
  1034.  * of that line (col == 0).  This avoids having to recompute the syntax state
  1035.  * too often.
  1036.  * b_sst_array[] is allocated to hold the state for all displayed lines, and
  1037.  * states for 1 out of about 20 other lines.
  1038.  * b_sst_array        pointer to an array of synstate_T
  1039.  * b_sst_len        number of entries in b_sst_array[]
  1040.  * b_sst_first        pointer to first used entry in b_sst_array[] or NULL
  1041.  * b_sst_firstfree    pointer to first free entry in b_sst_array[] or NULL
  1042.  * b_sst_freecount    number of free entries in b_sst_array[]
  1043.  * b_sst_check_lnum    entries after this lnum need to be checked for
  1044.  *            validity (MAXLNUM means no check needed)
  1045.  */
  1046.     synstate_T    *b_sst_array;
  1047.     int        b_sst_len;
  1048.     synstate_T    *b_sst_first;
  1049.     synstate_T    *b_sst_firstfree;
  1050.     int        b_sst_freecount;
  1051.     linenr_T    b_sst_check_lnum;
  1052.     short_u    b_sst_lasttick;    /* last display tick */
  1053. #endif /* FEAT_SYN_HL */
  1054.  
  1055. #ifdef FEAT_SIGNS
  1056.     signlist_T    *b_signlist;    /* list of signs to draw */
  1057. #endif
  1058.  
  1059. };
  1060.  
  1061. /*
  1062.  * Structure to cache info for displayed lines in w_lines[].
  1063.  * Each logical line has one entry.
  1064.  * The entry tells how the logical line is currently displayed in the window.
  1065.  * This is updated when displaying the window.
  1066.  * When the display is changed (e.g., when clearing the screen) w_lines_valid
  1067.  * is changed to exclude invalid entries.
  1068.  * When making changes to the buffer, wl_valid is reset to indicate wl_size
  1069.  * may not reflect what is actually in the buffer.  When wl_valid is FALSE,
  1070.  * the entries can only be used to count the number of displayed lines used.
  1071.  * wl_lnum and wl_lastlnum are invalid too.
  1072.  */
  1073. typedef struct w_line
  1074. {
  1075.     linenr_T    wl_lnum;    /* buffer line number for logical line */
  1076.     short_u    wl_size;    /* height in screen lines */
  1077.     char    wl_valid;    /* TRUE values are valid for text in buffer */
  1078. #ifdef FEAT_FOLDING
  1079.     char    wl_folded;    /* TRUE when this is a range of folded lines */
  1080.     linenr_T    wl_lastlnum;    /* last buffer line number for logical line */
  1081. #endif
  1082. } wline_T;
  1083.  
  1084. /*
  1085.  * Windows are kept in a tree of frames.  Each frame has a column (FR_COL)
  1086.  * or row (FR_ROW) layout or is a leaf, which has a window.
  1087.  */
  1088. struct frame
  1089. {
  1090.     char    fr_layout;    /* FR_LEAF, FR_COL or FR_ROW */
  1091. #ifdef FEAT_VERTSPLIT
  1092.     int        fr_width;
  1093. #endif
  1094.     int        fr_height;
  1095.     frame_T    *fr_parent;    /* containing frame or NULL */
  1096.     frame_T    *fr_next;    /* frame right or below in same parent, NULL
  1097.                    for first */
  1098.     frame_T    *fr_prev;    /* frame left or above in same parent, NULL
  1099.                    for last */
  1100.     /* fr_child and fr_win are mutually exclusive */
  1101.     frame_T    *fr_child;    /* first contained frame */
  1102.     win_T    *fr_win;    /* window that fills this frame */
  1103. };
  1104.  
  1105. #define FR_LEAF    0    /* frame is a leaf */
  1106. #define FR_ROW    1    /* frame with a row of windows */
  1107. #define FR_COL    2    /* frame with a column of windows */
  1108.  
  1109. /*
  1110.  * Structure which contains all information that belongs to a window
  1111.  *
  1112.  * All row numbers are relative to the start of the window, except w_winrow.
  1113.  */
  1114. struct window
  1115. {
  1116.     buf_T    *w_buffer;        /* buffer we are a window into (used
  1117.                        often, keep it the first item!) */
  1118.  
  1119. #ifdef FEAT_WINDOWS
  1120.     win_T    *w_prev;        /* link to previous window */
  1121.     win_T    *w_next;        /* link to next window */
  1122. #endif
  1123.  
  1124.     frame_T    *w_frame;        /* frame containing this window */
  1125.  
  1126.     pos_T    w_cursor;        /* cursor position in buffer */
  1127.  
  1128.     colnr_T    w_curswant;        /* The column we'd like to be at.  This is
  1129.                        used to try to stay in the same column
  1130.                        for up/down cursor motions. */
  1131.  
  1132.     int        w_set_curswant;        /* If set, then update w_curswant the next
  1133.                        time through cursupdate() to the
  1134.                        current virtual column */
  1135.  
  1136. #ifdef FEAT_VISUAL
  1137.     /*
  1138.      * the next six are used to update the visual part
  1139.      */
  1140.     char    w_old_visual_mode;  /* last known VIsual_mode */
  1141.     linenr_T    w_old_cursor_lnum;  /* last known end of visual part */
  1142.     colnr_T    w_old_cursor_fcol;  /* first column for block visual part */
  1143.     colnr_T    w_old_cursor_lcol;  /* last column for block visual part */
  1144.     linenr_T    w_old_visual_lnum;  /* last known start of visual part */
  1145.     colnr_T    w_old_curswant;        /* last known value of Curswant */
  1146. #endif
  1147.  
  1148.     /*
  1149.      * The next three specify the offsets for displaying the buffer:
  1150.      */
  1151.     linenr_T    w_topline;        /* buffer line number of the line at the
  1152.                        top of the window */
  1153. #ifdef FEAT_DIFF
  1154.     int        w_topfill;        /* number of filler lines above w_topline */
  1155.     int        w_old_topfill;        /* w_topfill at last redraw */
  1156.     int        w_botfill;        /* TRUE when filler lines are actually
  1157.                        below w_topline (at end of file) */
  1158.     int        w_old_botfill;        /* w_botfill at last redraw */
  1159. #endif
  1160.     colnr_T    w_leftcol;        /* window column number of the left most
  1161.                        character in the window; used when
  1162.                        'wrap' is off */
  1163.     colnr_T    w_skipcol;        /* starting column when a single line
  1164.                        doesn't fit in the window */
  1165.  
  1166.     /*
  1167.      * Layout of the window in the screen.
  1168.      * May need to add "msg_scrolled" to "w_winrow" in rare situations.
  1169.      */
  1170. #ifdef FEAT_WINDOWS
  1171.     int        w_winrow;        /* first row of window in screen */
  1172. #endif
  1173.     int        w_height;        /* number of rows in window, excluding
  1174.                        status/command line(s) */
  1175. #ifdef FEAT_WINDOWS
  1176.     int        w_status_height;    /* number of status lines (0 or 1) */
  1177. #endif
  1178. #ifdef FEAT_VERTSPLIT
  1179.     int        w_wincol;        /* Leftmost column of window in screen.
  1180.                        use W_WINCOL() */
  1181.     int        w_width;        /* Width of window, excluding separation.
  1182.                        use W_WIDTH() */
  1183.     int        w_vsep_width;        /* Number of separator columns (0 or 1).
  1184.                        use W_VSEP_WIDTH() */
  1185. #endif
  1186.  
  1187.     /*
  1188.      * === start of cached values ====
  1189.      */
  1190.     /*
  1191.      * Recomputing is minimized by storing the result of computations.
  1192.      * Use functions in screen.c to check if they are valid and to update.
  1193.      * w_valid is a bitfield of flags, which indicate if specific values are
  1194.      * valid or need to be recomputed.    See screen.c for values.
  1195.      */
  1196.     int        w_valid;
  1197.     pos_T    w_valid_cursor;        /* last known position of w_cursor, used
  1198.                        to adjust w_valid */
  1199.     colnr_T    w_valid_leftcol;    /* last known w_leftcol */
  1200.  
  1201.     /*
  1202.      * w_cline_height is the number of physical lines taken by the buffer line
  1203.      * that the cursor is on.  We use this to avoid extra calls to plines().
  1204.      */
  1205.     int        w_cline_height;        /* current size of cursor line */
  1206. #ifdef FEAT_FOLDING
  1207.     int        w_cline_folded;        /* cursor line is folded */
  1208. #endif
  1209.  
  1210.     int        w_cline_row;        /* starting row of the cursor line */
  1211.  
  1212.     colnr_T    w_virtcol;        /* column number of the cursor in the
  1213.                        buffer line, as opposed to the column
  1214.                        number we're at on the screen.  This
  1215.                        makes a difference on lines which span
  1216.                        more than one screen line or when
  1217.                        w_leftcol is non-zero */
  1218.  
  1219.     /*
  1220.      * w_wrow and w_wcol specify the cursor position in the window.
  1221.      * This is related to positions in the window, not in the display or
  1222.      * buffer, thus w_wrow is relative to w_winrow.
  1223.      */
  1224.     int        w_wrow, w_wcol;        /* cursor position in window */
  1225.  
  1226.     linenr_T    w_botline;        /* number of the line below the bottom of
  1227.                        the screen */
  1228.     int        w_empty_rows;        /* number of ~ rows in window */
  1229. #ifdef FEAT_DIFF
  1230.     int        w_filler_rows;        /* number of filler rows at the end of the
  1231.                        window */
  1232. #endif
  1233.  
  1234.     /*
  1235.      * Info about the lines currently in the window is remembered to avoid
  1236.      * recomputing it every time.  The allocated size of w_lines[] is Rows.
  1237.      * Only the w_lines_valid entries are actually valid.
  1238.      * When the display is up-to-date w_lines[0].wl_lnum is equal to w_topline
  1239.      * and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
  1240.      * Between changing text and updating the display w_lines[] represents
  1241.      * what is currently displayed.  wl_valid is reset to indicated this.
  1242.      * This is used for efficient redrawing.
  1243.      */
  1244.     int        w_lines_valid;        /* number of valid entries */
  1245.     wline_T    *w_lines;
  1246.  
  1247. #ifdef FEAT_FOLDING
  1248.     garray_T    w_folds;        /* array of nested folds */
  1249.     char    w_fold_manual;        /* when TRUE: some folds are opened/closed
  1250.                        manually */
  1251.     char    w_foldinvalid;        /* when TRUE: folding needs to be
  1252.                        recomputed */
  1253. #endif
  1254.  
  1255.     /*
  1256.      * === end of cached values ===
  1257.      */
  1258.  
  1259.     int        w_redr_type;        /* type of redraw to be performed on win */
  1260.     int        w_upd_rows;        /* number of window lines to update when
  1261.                        w_redr_type is REDRAW_TOP */
  1262.     linenr_T    w_redraw_top;        /* when != 0: first line needing redraw */
  1263.     linenr_T    w_redraw_bot;        /* when != 0: last line needing redraw */
  1264. #ifdef FEAT_WINDOWS
  1265.     int        w_redr_status;        /* if TRUE status line must be redrawn */
  1266. #endif
  1267.  
  1268. #ifdef FEAT_CMDL_INFO
  1269.     /* remember what is shown in the ruler for this window (if 'ruler' set) */
  1270.     pos_T    w_ru_cursor;        /* cursor position shown in ruler */
  1271.     colnr_T    w_ru_virtcol;        /* virtcol shown in ruler */
  1272.     linenr_T    w_ru_topline;        /* topline shown in ruler */
  1273. # ifdef FEAT_DIFF
  1274.     int        w_ru_topfill;        /* topfill shown in ruler */
  1275. # endif
  1276.     char    w_ru_empty;        /* TRUE if ruler shows 0-1 (empty line) */
  1277. #endif
  1278.  
  1279.     int        w_alt_fnum;        /* alternate file (for # and CTRL-^) */
  1280.  
  1281. #ifdef FEAT_WINDOWS
  1282.     alist_T    *w_alist;        /* pointer to arglist for this window */
  1283. #endif
  1284.     int        w_arg_idx;        /* current index in argument list (can be
  1285.                        out of range!) */
  1286.     int        w_arg_idx_invalid;  /* editing another file then w_arg_idx */
  1287.  
  1288.     char_u    *w_localdir;        /* absolute path of local directory or
  1289.                        NULL */
  1290.     /*
  1291.      * Options local to a window.
  1292.      * They are local because they influence the layout of the window or
  1293.      * depend on the window layout.
  1294.      * There are two values: w_onebuf_opt is local to the buffer currently in
  1295.      * this window, w_allbuf_opt is for all buffers in this window.
  1296.      */
  1297.     winopt_T    w_onebuf_opt;
  1298.     winopt_T    w_allbuf_opt;
  1299.  
  1300.     /* transfor a pointer to a "onebuf" option to a "allbuf" option */
  1301. #define GLOBAL_WO(p)    ((char *)p + sizeof(winopt_T))
  1302.  
  1303. #ifdef FEAT_SCROLLBIND
  1304.     long    w_scbind_pos;
  1305. #endif
  1306.  
  1307. #ifdef FEAT_EVAL
  1308.     garray_T    w_vars;        /* internal variables, local to window */
  1309. #endif
  1310.  
  1311. #if defined(FEAT_RIGHTLEFT) && defined(FEAT_FKMAP)
  1312.     int        w_farsi;    /* for the window dependent Farsi functions */
  1313. #endif
  1314.  
  1315.     /*
  1316.      * The w_prev_pcmark field is used to check whether we really did jump to
  1317.      * a new line after setting the w_pcmark.  If not, then we revert to
  1318.      * using the previous w_pcmark.
  1319.      */
  1320.     pos_T    w_pcmark;    /* previous context mark */
  1321.     pos_T    w_prev_pcmark;    /* previous w_pcmark */
  1322.  
  1323. #ifdef FEAT_JUMPLIST
  1324.     /*
  1325.      * the jumplist contains old cursor positions
  1326.      */
  1327.     xfmark_T    w_jumplist[JUMPLISTSIZE];
  1328.     int        w_jumplistlen;        /* number of active entries */
  1329.     int        w_jumplistidx;        /* current position */
  1330. #endif
  1331.  
  1332. #ifdef FEAT_SEARCH_EXTRA
  1333.     regmmatch_T    w_match;    /* regexp program for ":match" */
  1334.     int        w_match_id;    /* highlight ID for ":match" */
  1335. #endif
  1336.  
  1337.     /*
  1338.      * the tagstack grows from 0 upwards:
  1339.      * entry 0: older
  1340.      * entry 1: newer
  1341.      * entry 2: newest
  1342.      */
  1343.     taggy_T    w_tagstack[TAGSTACKSIZE];    /* the tag stack */
  1344.     int        w_tagstackidx;        /* idx just below activ entry */
  1345.     int        w_tagstacklen;        /* number of tags on stack */
  1346.  
  1347.     /*
  1348.      * w_fraction is the fractional row of the cursor within the window, from
  1349.      * 0 at the top row to FRACTION_MULT at the last row.
  1350.      * w_prev_fraction_row was the actual cursor row when w_fraction was last
  1351.      * calculated.
  1352.      */
  1353.     int        w_fraction;
  1354.     int        w_prev_fraction_row;
  1355.  
  1356. #ifdef FEAT_GUI
  1357.     scrollbar_T    w_scrollbars[2];    /* vert. Scrollbars for this window */
  1358. #endif
  1359.  
  1360. #ifdef FEAT_PERL
  1361.     void    *perl_private;
  1362. #endif
  1363.  
  1364. #ifdef FEAT_PYTHON
  1365.     void    *python_ref;    /* The Python value referring to this
  1366.                        window */
  1367. #endif
  1368.  
  1369. #ifdef FEAT_TCL
  1370.     void    *tcl_ref;
  1371. #endif
  1372.  
  1373. #ifdef FEAT_RUBY
  1374.     void    *ruby_ref;
  1375. #endif
  1376. };
  1377.  
  1378. /*
  1379.  * Arguments for operators.
  1380.  */
  1381. typedef struct oparg
  1382. {
  1383.     int        op_type;    /* current pending operator type */
  1384.     int        regname;    /* register to use for the operator */
  1385.     int        motion_type;    /* type of the current cursor motion */
  1386.     int        motion_force;    /* force motion type: 'v', 'V' or CTRL-V */
  1387.     int        use_reg_one;    /* TRUE if delete uses reg 1 even when not
  1388.                    linewise */
  1389.     int        inclusive;    /* TRUE if char motion is inclusive (only
  1390.                    valid when motion_type is MCHAR */
  1391.     int        end_adjusted;    /* backuped b_op_end one char (only used by
  1392.                    do_format()) */
  1393.     pos_T    start;        /* start of the operator */
  1394.     pos_T    end;        /* end of the operator */
  1395.  
  1396.     long    line_count;    /* number of lines from op_start to op_end
  1397.                    (inclusive) */
  1398.     int        empty;        /* op_start and op_end the same (only used by
  1399.                    do_change()) */
  1400. #ifdef FEAT_VISUAL
  1401.     int        is_VIsual;    /* operator on Visual area */
  1402. #endif
  1403.     int        block_mode;    /* current operator is Visual block mode */
  1404.     colnr_T    start_vcol;    /* start col for block mode operator */
  1405.     colnr_T    end_vcol;    /* end col for block mode operator */
  1406. } oparg_T;
  1407.  
  1408. /*
  1409.  * Arguments for Normal mode commands.
  1410.  */
  1411. typedef struct cmdarg
  1412. {
  1413.     oparg_T    *oap;        /* Operator arguments */
  1414.     int        prechar;    /* prefix character (optional, always 'g') */
  1415.     int        cmdchar;    /* command character */
  1416.     int        nchar;        /* next command character (optional) */
  1417. #ifdef FEAT_MBYTE
  1418.     int        ncharC1;    /* first composing character (optional) */
  1419.     int        ncharC2;    /* second composing character (optional) */
  1420. #endif
  1421.     int        extra_char;    /* yet another character (optional) */
  1422.     long    opcount;    /* count before an operator */
  1423.     long    count0;        /* count before command, default 0 */
  1424.     long    count1;        /* count before command, default 1 */
  1425.     int        arg;        /* extra argument from nv_cmds[] */
  1426.     int        retval;        /* return: CA_* values */
  1427.     char_u    *searchbuf;    /* return: pointer to search pattern or NULL */
  1428. } cmdarg_T;
  1429.  
  1430. /* values for retval: */
  1431. #define CA_COMMAND_BUSY        1    /* skip restarting edit() once */
  1432. #define CA_NO_ADJ_OP_END    2    /* don't adjust operator end */
  1433.  
  1434. #ifdef CURSOR_SHAPE
  1435. /*
  1436.  * struct to store values from 'guicursor' and 'mouseshape'
  1437.  */
  1438. /* Indexes in shape_table[] */
  1439. #define SHAPE_IDX_N    0    /* Normal mode */
  1440. #define SHAPE_IDX_V    1    /* Visual mode */
  1441. #define SHAPE_IDX_I    2    /* Insert mode */
  1442. #define SHAPE_IDX_R    3    /* Replace mode */
  1443. #define SHAPE_IDX_C    4    /* Command line Normal mode */
  1444. #define SHAPE_IDX_CI    5    /* Command line Insert mode */
  1445. #define SHAPE_IDX_CR    6    /* Command line Replace mode */
  1446. #define SHAPE_IDX_O    7    /* Operator-pending mode */
  1447. #define SHAPE_IDX_VE    8    /* Visual mode with 'seleciton' exclusive */
  1448. #define SHAPE_IDX_CLINE    9    /* On command line */
  1449. #define SHAPE_IDX_STATUS 10    /* A status line */
  1450. #define SHAPE_IDX_SDRAG 11    /* dragging a status line */
  1451. #define SHAPE_IDX_VSEP    12    /* A vertical separator line */
  1452. #define SHAPE_IDX_VDRAG 13    /* dragging a vertical separator line */
  1453. #define SHAPE_IDX_MORE    14    /* Hit-return or More */
  1454. #define SHAPE_IDX_SM    15    /* showing matching paren */
  1455. #define SHAPE_IDX_COUNT    16
  1456.  
  1457. #define SHAPE_BLOCK    0    /* block cursor */
  1458. #define SHAPE_HOR    1    /* horizontal bar cursor */
  1459. #define SHAPE_VER    2    /* vertical bar cursor */
  1460.  
  1461. #define MSHAPE_NUMBERED    1000    /* offset for shapes identified by number */
  1462. #define MSHAPE_HIDE    1    /* hide mouse pointer */
  1463.  
  1464. #define SHAPE_MOUSE    1    /* used for mouse pointer shape */
  1465. #define SHAPE_CURSOR    2    /* used for text cursor shape */
  1466.  
  1467. typedef struct cursor_entry
  1468. {
  1469.     int        shape;        /* one of the SHAPE_ defines */
  1470.     int        mshape;        /* one of the MSHAPE defines */
  1471.     int        percentage;    /* percentage of cell for bar */
  1472.     long    blinkwait;    /* blinking, wait time before blinking starts */
  1473.     long    blinkon;    /* blinking, on time */
  1474.     long    blinkoff;    /* blinking, off time */
  1475.     int        id;        /* highlight group ID */
  1476.     int        id_lm;        /* highlight group ID for :lmap mode */
  1477.     char    *name;        /* mode name (fixed) */
  1478.     char    used_for;    /* SHAPE_MOUSE and/or SHAPE_CURSOR */
  1479. } cursorentry_T;
  1480. #endif /* CURSOR_SHAPE */
  1481.  
  1482. #ifdef FEAT_MENU
  1483.  
  1484. /* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */
  1485. #define MENU_INDEX_INVALID    -1
  1486. #define MENU_INDEX_NORMAL    0
  1487. #define MENU_INDEX_VISUAL    1
  1488. #define MENU_INDEX_OP_PENDING    2
  1489. #define MENU_INDEX_INSERT    3
  1490. #define MENU_INDEX_CMDLINE    4
  1491. #define MENU_INDEX_TIP        5
  1492. #define MENU_MODES        6
  1493.  
  1494. /* Menu modes */
  1495. #define MENU_NORMAL_MODE    (1 << MENU_INDEX_NORMAL)
  1496. #define MENU_VISUAL_MODE    (1 << MENU_INDEX_VISUAL)
  1497. #define MENU_OP_PENDING_MODE    (1 << MENU_INDEX_OP_PENDING)
  1498. #define MENU_INSERT_MODE    (1 << MENU_INDEX_INSERT)
  1499. #define MENU_CMDLINE_MODE    (1 << MENU_INDEX_CMDLINE)
  1500. #define MENU_TIP_MODE        (1 << MENU_INDEX_TIP)
  1501. #define MENU_ALL_MODES        ((1 << MENU_INDEX_TIP) - 1)
  1502. /*note MENU_INDEX_TIP is not a 'real' mode*/
  1503.  
  1504. /* Start a menu name with this to not include it on the main menu bar */
  1505. #define MNU_HIDDEN_CHAR        ']'
  1506.  
  1507. typedef struct VimMenu vimmenu_T;
  1508.  
  1509. struct VimMenu
  1510. {
  1511.     int        modes;            /* Which modes is this menu visible for? */
  1512.     int        enabled;        /* for which modes the menu is enabled */
  1513.     char_u    *name;            /* Name of menu */
  1514.     char_u    *dname;            /* Displayed Name (without '&') */
  1515.     int        mnemonic;        /* mnemonic key (after '&') */
  1516.     char_u    *actext;        /* accelerator text (after TAB) */
  1517.     int        priority;        /* Menu order priority */
  1518. #ifdef FEAT_GUI
  1519.     void    (*cb)();        /* Call-back routine */
  1520. #endif
  1521. #ifdef FEAT_TOOLBAR
  1522.     char_u    *iconfile;        /* name of file for icon or NULL */
  1523.     int        iconidx;        /* icon index (-1 if not set) */
  1524.     int        icon_builtin;        /* icon names is BuiltIn{nr} */
  1525. #endif
  1526.     char_u    *strings[MENU_MODES]; /* Mapped string for each mode */
  1527.     int        noremap[MENU_MODES]; /* A REMAP_ flag for each mode */
  1528.     char    silent[MENU_MODES]; /* A silent flag for each mode */
  1529.     vimmenu_T    *children;        /* Children of sub-menu */
  1530.     vimmenu_T    *parent;        /* Parent of menu */
  1531.     vimmenu_T    *next;            /* Next item in menu */
  1532. #ifdef FEAT_GUI_X11
  1533.     Widget    id;            /* Manage this to enable item */
  1534.     Widget    submenu_id;        /* If this is submenu, add children here */
  1535. #endif
  1536. #ifdef FEAT_GUI_GTK
  1537.     GtkWidget    *id;            /* Manage this to enable item */
  1538.     GtkWidget    *submenu_id;        /* If this is submenu, add children here */
  1539.     GtkWidget    *tearoff_handle;
  1540.     GtkWidget   *label;            /* Used by "set wak=" code. */
  1541. #endif
  1542. #ifdef FEAT_GUI_MOTIF
  1543.     int        sensitive;        /* turn button on/off */
  1544. #endif
  1545. #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF)
  1546.     Pixmap    image;            /* Toolbar image */
  1547. #endif
  1548. #ifdef FEAT_GUI_MOTIF
  1549.     Pixmap    image_ins;        /* Toolbar image insensitive */
  1550. #endif
  1551. #ifdef FEAT_BEVAL
  1552.     BalloonEval *tip;            /* tooltip for this menu item */
  1553. #endif
  1554. #ifdef FEAT_GUI_W16
  1555.     UINT    id;            /* Id of menu item */
  1556.     HMENU    submenu_id;        /* If this is submenu, add children here */
  1557. #endif
  1558. #ifdef FEAT_GUI_W32
  1559.     UINT    id;            /* Id of menu item */
  1560.     HMENU    submenu_id;        /* If this is submenu, add children here */
  1561.     HWND    tearoff_handle;        /* hWnd of tearoff if created */
  1562. #endif
  1563. #if FEAT_GUI_BEOS
  1564.     BMenuItem    *id;            /* Id of menu item */
  1565.     BMenu    *submenu_id;        /* If this is submenu, add children here */
  1566. #endif
  1567. #ifdef FEAT_GUI_MAC
  1568. /*  MenuHandle    id; */
  1569. /*  short    index;    */        /* the item index within the father menu */
  1570.     short    menu_id;        /* the menu id to which this item belong */
  1571.     short    submenu_id;        /* the menu id of the children (could be
  1572.                        get throught some tricks) */
  1573.     MenuHandle    menu_handle;
  1574.     MenuHandle    submenu_handle;
  1575. #endif
  1576. #if defined(FEAT_GUI_AMIGA)
  1577.                     /* only one of these will ever be set, but
  1578.                      * they are used to allow the menu routine
  1579.                      * to easily get a hold of the parent menu
  1580.                      * pointer which is needed by all items to
  1581.                      * form the chain correctly */
  1582.     int            id;            /* unused by the amiga, but used in the
  1583.                      * code kept for compatibility */
  1584.     struct Menu        *menuPtr;
  1585.     struct MenuItem *menuItemPtr;
  1586. #endif
  1587. #ifdef RISCOS
  1588.     int        *id;            /* Not used, but gui.c needs it */
  1589.     int        greyed_out;        /* Flag */
  1590.     int        hidden;
  1591. #endif
  1592. #ifdef FEAT_GUI_PHOTON
  1593.     PtWidget_t    *id;
  1594.     PtWidget_t    *submenu_id;
  1595. #endif
  1596. };
  1597. #else
  1598. /* For generating prototypes when FEAT_MENU isn't defined. */
  1599. typedef int vimmenu_T;
  1600.  
  1601. #endif /* FEAT_MENU */
  1602.  
  1603. /*
  1604.  * Struct to save values in before executing autocommands for a buffer that is
  1605.  * not the current buffer.
  1606.  */
  1607. typedef struct
  1608. {
  1609.     buf_T    *save_buf;    /* saved curbuf */
  1610.     buf_T    *new_curbuf;    /* buffer to be used */
  1611.     win_T    *save_curwin;    /* saved curwin, NULL if it didn't change */
  1612.     win_T    *new_curwin;    /* new curwin if save_curwin != NULL */
  1613.     pos_T    save_cursor;    /* saved cursor pos of save_curwin */
  1614.     linenr_T    save_topline;    /* saved topline of save_curwin */
  1615. #ifdef FEAT_DIFF
  1616.     int        save_topfill;    /* saved topfill of save_curwin */
  1617. #endif
  1618. } aco_save_T;
  1619.  
  1620. /*
  1621.  * Generic option table item, only used for printer at the moment.
  1622.  */
  1623. typedef struct {
  1624.     const char    *name;
  1625.     int        hasnum;
  1626.     long    number;
  1627.     char_u    *string;    /* points into option string */
  1628.     int        strlen;
  1629.     int        present;
  1630. } option_table_T;
  1631.  
  1632.  
  1633. /*
  1634.  * Structure passed back to the generic printer code.
  1635.  */
  1636. typedef struct
  1637. {
  1638.     int        n_collated_copies;
  1639.     int        n_uncollated_copies;
  1640.     int        duplex;
  1641.     int        chars_per_line;
  1642.     int        lines_per_page;
  1643.     int        has_color;
  1644. #ifdef FEAT_SYN_HL
  1645.     int        do_syntax;
  1646. #endif
  1647.     int        user_abort;
  1648.     char_u    *jobname;
  1649. #ifdef FEAT_POSTSCRIPT
  1650.     char_u    *outfile;
  1651.     char_u    *arguments;
  1652. #endif
  1653. } prt_settings_T;
  1654.  
  1655. #define PRINT_NUMBER_WIDTH 8
  1656.